<template>
  <div class="SetMain">

    <!--<header class="aui-bar aui-bar-nav">-->
      <!--<a class="aui-pull-left aui-btn" style="font-size: 1.5rem !important">-->
        <!--<img @click="finishDeviceA()" style="width: 2.5rem;margin-top: -0.2rem" src="../img/back-b.png" alt="">&nbsp;&nbsp;更多信息-->
      <!--</a>-->
    <!--</header>-->

    <div  class="aui-bar aui-bar-nav" style="    margin-left: 0 !important;">
      <a class="aui-pull-left" style="font-weight:100 !important;font-size: 18px !important;color: white !important;    margin-left: -10px !important;" @click="goBack()" >
        <img style="padding:48% 0; width: 2.5rem;
    margin-top: -1.6rem;" src="../img/back-b.png" @click="finishDeviceA()" alt="">
      </a>
      <div >
            <span style="left:4.5rem;position: absolute;color: black; font-size: 18px;	font-family: 'Helvetica Neue', Helvetica, sans-serif;">
              更多信息
            </span>
        <!--<div class="ConnectStatus" v-if="ConnectStatus==false"> {{cleanMode}} </div>-->
      </div>
    </div>
    <div>
      <div class="aui-content" style="margin-top: 0rem">
        <ul class="aui-list aui-list-in" style="background-size:100% 0px;">
          <li class="aui-list-item">
            <div class="aui-list-item-inner">
              <div class="aui-list-item-title">马桶静音</div>
              <div class="aui-list-item-right"  v-if="showAlert==false">
                <input id="Mute"  v-if="havInited==true"  @click="setMain('Mute')" v-model="Mute" type="checkbox" class="aui-switch" >
                <input  v-if="havInited==false" disabled="disabled"  @click="setMain('Mute')" v-model="Mute" type="checkbox" class="aui-switch" >
              </div>
              <div class="aui-list-item-right" v-if="showAlert==true">
                <img src="../img/loading/Setloading.gif" style="width: 2rem"/>
              </div>
            </div>
          </li>
          <li class="aui-list-item">
            <div class="aui-list-item-inner">
              <div class="aui-list-item-title">自动翻盖</div>
              <div class="aui-list-item-right"  v-if="showAlert==false">
                <input id="fangG" v-if="havInited==true" type="checkbox" v-model="fangG" @click="setMain('fangG')" class="aui-switch">
                <input v-if="havInited==false" disabled="disabled" type="checkbox" v-model="fangG" @click="setMain('fangG')" class="aui-switch">
              </div>
              <div class="aui-list-item-right" v-if="showAlert==true">
                <img src="../img/loading/Setloading.gif" style="width: 2rem"/>
              </div>
            </div>
          </li>
          <li class="aui-list-item">
            <div class="aui-list-item-inner">
              <div class="aui-list-item-title">手动清洗喷嘴</div>
              <div class="aui-list-item-right"  v-if="showAlert==false">
                <input id="qingXi" type="checkbox" v-if="havInited==true" v-model="qingXi" @click="setMain('qingXi')" class="aui-switch">
                <input type="checkbox" v-if="havInited==false" disabled="disabled" v-model="qingXi" @click="setMain('qingXi')" class="aui-switch">
              </div>
              <div class="aui-list-item-right" v-if="showAlert==true">
                <img src="../img/loading/Setloading.gif" style="width: 2rem"/>
              </div>
            </div>
          </li>
          <li class="aui-list-item">
            <div class="aui-list-item-inner">
              <div class="aui-list-item-title">夜灯</div>
              <div class="aui-list-item-right" v-if="showAlert==false">
                <input id="Ydeng" v-if="havInited==true" type="checkbox" v-model="Ydeng" @click="setMain('Ydeng')" class="aui-switch">
                <input v-if="havInited==false" disabled="disabled" type="checkbox" v-model="Ydeng" @click="setMain('Ydeng')" class="aui-switch">
              </div>
              <div class="aui-list-item-right" v-if="showAlert==true">
                <img src="../img/loading/Setloading.gif" style="width: 2rem"/>
              </div>
            </div>
          </li>
          <li class="aui-list-item">
            <div @click="setMain('pengzzj')" class="aui-list-item-inner">
              <div  class="aui-list-item-title">喷嘴自洁</div>
              <!--<div class="aui-list-item-right">-->
                <!--<input id="pengzzj"  v-model="pengzzj" type="checkbox" @click="setMain('pengzzj')" class="aui-switch" checked>-->
              <!--</div>-->
            </div>
          </li>
          <li class="aui-list-item">
            <div @click="setMain('sdqxjcc')" class="aui-list-item-inner">
              <div  class="aui-list-item-title">打开检测槽</div>
            </div>
          </li>
          <li class="aui-list-item">
            <div @click="setMain('sdqxjccclose')" class="aui-list-item-inner">
              <div  class="aui-list-item-title">关闭检测槽</div>
            </div>
          </li>
        </ul>
      </div>
      <!--<div style="background: #f4f4f4;height:0.5rem;width:100%"></div>-->
      <!--<div @click="goPath('/bangzhu')" style="padding: 1rem 0.5rem;margin-left: 1rem">-->
        <!--<div style="font-size: 1.4rem"> 常见问题 </div>-->
        <!--&lt;!&ndash;<div class="aui-pull-right"><i class="aui-iconfont aui-icon-right"></i></div>&ndash;&gt;-->
      <!--</div>-->

      <div v-if="OSTypeSet==false" style="background: #f4f4f4;height:0.5rem;width:100%"></div>
      <div v-if="OSTypeSet==false" @click="goPath('/yinsismmore')" style="padding: 1rem 0.5rem;margin-left: 1rem">
        <div style="font-size: 1.4rem"> 隐私声明 </div>
        <!--<div class="aui-pull-right"><i class="aui-iconfont aui-icon-right"></i></div>-->
      </div>

      <div v-if="OSTypeSet==false" style="background: #f4f4f4;height:0.5rem;width:100%"></div>
    <div v-if="OSTypeSet==false" @click="goPath('/yinsismset')" style="padding: 1rem 0.5rem;margin-left: 1rem">
      <div style="font-size: 1.4rem"> 撤销授权 </div>
      <!--<div class="aui-pull-right"><i class="aui-iconfont aui-icon-right"></i></div>-->
    </div>

      <!--<div style="background: #f4f4f4;height:0.5rem;width:100%"></div>-->
      <!--<div class="aui-content detection" @click="UpdateSystem()" style="padding: 1rem 0.5rem">-->
        <!--<div class="aui-pull-left jiancegengxin" style="font-size: 1.4rem">检测更新 <i v-if="isUpdateInYUN" class="tip"></i></div>-->
        <!--&lt;!&ndash;<div class="aui-pull-right"><i class="aui-iconfont aui-icon-right"></i></div>&ndash;&gt;-->
      <!--</div>-->

    </div>
    <LoadingInit v-if="showAlert" ></LoadingInit>
    <connectinit v-if="ConnectStatus===false"></connectinit>
    <addtoAlert v-if="showAddtoAlert"></addtoAlert>
    <zijieLoading v-if="zijieIng"></zijieLoading>
    <showAlertLoading v-if="showAlertLoad"></showAlertLoading>

  </div>
</template>

<script>
  import {mapMutations,mapState} from 'vuex'

  import Vue from 'vue'
  import zijieLoading from '../../common/zijieLoading'
  import Loading from '../../common/Loading'
  import addtoAlert from '../../common/addtoAlert'
  import LoadingInit from '../../common/LoadingInit'
  import connectinit from '../../common/connectinit'

  import showAlertLoading from '../../common/showAlertLoading'

  import ProcessSJ from '../../common/ProcessSJ'
  import {Register} from '../../../store/_CRC'
  import axios from 'axios'
  import VueAxios from 'vue-axios'

  Vue.use(VueAxios, axios)

export default {
  name: 'SetMain',
  data () {
    return {
      TbIng:false,

      IsclearCC:false,
      showAlertLoad:false,
      MuteLoad:true,
      fangGLoad:true,
      qingXiLoad:true,

      BANBEN:0,
      zijieIng:false,
      isONSC:false,
      exitTime:0,
      showAddtoAlert:false,
      havInited:false,
      CanClickTimes:true,
      showAlert:true,
      textTT: '',
      totalLength:0,
      showLoading:false,
      alertText:'正在升级设备，离开蓝牙检测范围或断开蓝牙会导致功能无法使用。',
      LeftText: '',
      RightText: '',
      iosUUIDTrth:'',
      iosUUIDCur:'',
      IsConnectType:false,
      deviceIdData:'',
      OSTypeSet: false,
      Ydeng:false,
      Mute : false,
      fangG : false,
      qingXi: false,
      tunXi:true,
      sdqxjcc:true,
      pengzzj:true,
    }
  },
  components: {
    showAlertLoading,
    zijieLoading,
    addtoAlert,
    connectinit,
    LoadingInit,
    Loading,
    ProcessSJ
  },
  computed: {
    ...mapState([
      'TempARRDevice',
      'pipei',
      'TempARRDevice',
      'isUpdateInYUN',
      'ConnectStatus',
      'showAlertState',
      'yiFaLength',
      'UpdateFileData',
      'IsUpdateTypeValueC',
      'reciveState',
      'reciveLen',
      'reciveData',
      'connectEnd',
      'stateData',
      'startAddr',
      'IsConnect ',
      'stateEndSet'
      // 'OSType'
      // 'getRegisterBitValue',
      // 'setRegisterBitValue'
    ])
  },
  watch: {
    yiFaLength (val) {
      this.showLoading = true
      this.totalLength = this.UpdateFileData.length
      this.textTT = this.totalLength+'/'+ this.yiFaLength
    },
    connectEnd (val) {
      // alert('读取数据')
      // this.WTGSTATE()
    },
    stateEndSet(val){
      this.stateEndSet = val
      clearInterval(window.setIntervalId)

      // this.stateEnd = false
      // alert('change')
      // if (this.IsclearCC==true){
        // if (this.stateData[50].data==0){
        //   this.sdqxjcc = true
        // } else {
        //     this.sdqxjcc = false
        // }
      // } else {
        this.initData()
      // }
    },
    ConnectStatus(val){
      console.log('gagagag909090')
      if(this.ConnectStatus==true) {
        this.showAddtoAlert = false
      }
      clearTimeout(window.SetTimeOUTc)
      var self = this
      if(this.ConnectStatus==false) {
        window.eqTime = function(){
          var now = new Date()
          if (now.getTime() > self.exitTime){
            if(self.ConnectStatus==false) {
              self.showAddtoAlert = true
            }
            clearInterval(window.ADDTOOut)
          }
        }

        var numberMillis = 20000
        var now = new Date()
        this.exitTime = now.getTime() + numberMillis
        clearInterval(window.ADDTOOut)
        window.ADDTOOut = setInterval("window.eqTime()",2000)
      }
    },

  },
  mounted (){
    var self = this
    this.INITmetodes()

    window.setAllLoading = function () {
      self.showAlert = false
      self.showAlertLoad = false
      self.fangGLoad = false
      self.qingXiLoad = false
      self.MuteLoad = false
    }

    window.fangGLoadingFalse = function () {
      self.fangGLoad = false
      self.showAlertLoad = false
    }

    window.qingXiLoadingFalse = function () {
      self.qingXiLoad = false
      self.showAlertLoad = false
    }

    window.MuteLoadingFalse = function () {
      self.MuteLoad = false
      self.showAlertLoad = false
    }

    window.connetState = function (re)
    {
      var d = new Date();
      var n = d.getTime();
      var data = eval("("+re+")")

      if(data.connected==true) {
        if(self.OSTypeSet==true) {
          console.log(self.iosUUIDCur)
          sleep(2000)
          window.hilink.readBLECharacteristicValue(self.iosUUIDCur ,"180A","2A23",'readBLECallBack')
          console.log('bbbb')
        }else{
          console.log('连接状态:'+data.connected+n)
          self.setConectStatus({val:true})

          window.setsettingsAlert(true)
          window.hilink.onBLECharacteristicValueChange ("ValueChange");
          if(self.IsConnectType==false) {
            setTimeout("setNotify()", 2000)
          }
          self.IsConnectType==true
        }
      } else {
        if (self.OSTypeSet==true) {
          if (self.pipei==true){
            self.setConectStatus({val:false})
            window.hilink.createBLEConnection(self.iosUUIDTrth)
          }
        } else {
          self.setConectStatus({val:false})
          window.hilink.createBLEConnection(self.deviceIdData)
        }
      }
    }
    window.wSetShow = function () {
      self.zijieIng = false
    }
    window.readBLECallBack = function(re){
      console.log('readBLECallBack777777777777777')
      var valueC = eval("("+re+")")
      var a=valueC.data
      var str6 = a.substr(a.length-6)
      var strr6 = a.substr(0,6)
      var str = str6[4]+str6[5]+":" + str6[2]+str6[3]+":"+str6[0]+str6[1]+":"+strr6[4]+strr6[5]+":"+strr6[2]+strr6[3]+":"+strr6[0]+strr6[1]
      console.log(str)
      console.log(str+'ppppppp')
      console.log(self.deviceIdData)
      if(self.deviceIdData.toLowerCase() === str.toLowerCase() ) {
        self.setPipe({val:true})
        self.setConectStatus({val:true})
        window.setsettingsAlert(true)
        self.iosUUIDTrth = self.iosUUIDCur
        console.log(self.ConnectStatus)
        console.log('连接状态IOS:成功')
        window.hilink.onBLECharacteristicValueChange ("ValueChange");

        // console.log(self.iosUUIDTrth)
        // if(self.IsConnectType==false) {
        //   window.hilink.getBLEDeviceCharacteristics(self.iosUUIDTrth,'ffe0','setNotifyIOS')
        // }
        self.IsConnectType==true
        var errcode = window.hilink.stopBluetoothDevicesDiscovery()

      } else {
        self.setPipe({val:false})
        window.hilink.closeBLEConnection(self.iosUUIDCur)
        window.PeconnectDeal()
      }
    }

    window.eqTime = function(){
      var now = new Date()
      if (now.getTime() > self.exitTime){
        console.log('aagag')
        self.showAddtoAlert = true
        clearInterval(window.ADDTOOut)
      }
    }
    // window.hilink.openBluetoothAdapter()

    window.checkConnect = function(){
      if(self.ConnectStatus==false) {
        self.showAddtoAlert = true
      }
    }
    window.SetTimeOUTc = setTimeout("checkConnect()",30000)
    this.SetMainMUT()

    window.onBluetoothAdapterStateChangeCallback = function(resultStr) {
      console.log(resultStr);
      var data = eval("("+resultStr+")")
      if(data.available==true){
        console.log('重新连接');
        self.isONSC = true
        window.hilink.getSystemInfoSync('getSystemInfoSyncCallBack')
      } else{
        self.setConectStatus({val:false})
        window.setsettingsAlert(false)
        window.hilink.openBluetoothAdapter()
      }
    }
    window.hilink.onBluetoothAdapterStateChange('onBluetoothAdapterStateChangeCallback');
    window.hilink.openBluetoothAdapter()


    if(this.isONSC==true) {

    }else{
      window.hilink.getSystemInfoSync('getSystemInfoSyncCallBack')
    }
  },
  methods: {
    ...mapMutations(['setRegisterBitValue','SetMainMUT','SetIsUpdateTypeValueC','AxiosTdev','setConectStatus','SetisUpdateInYUN','OPJCLOSS','setPipe','OPJCC',
      'OPNCC'
    ]),
    goPath(val){
      // clearInterval(window.setIntervalId)
      this.$router.push(val)
    },
    INITmetodes(){
      var self = this
      window.sleep = function(numberMillis) {
        var now = new Date();
        var exitTime = now.getTime() + numberMillis;
        while (true) {
          now = new Date();
          if (now.getTime() > exitTime)
            return;
        }
      }
      window.setNotify = function ()
      {
        var d = new Date()
        var n = d.getTime()
        var deviceId = window.getStorageSync('deviceId');
        var serviceId = window.getStorageSync('serviceId');
        var characteristicId = window.getStorageSync('characteristicId');
        var re = window.hilink.notifyBLECharacteristicValueChange(deviceId,serviceId,characteristicId,true);
        // window.hilink.onBLECharacteristicValueChange ("ValueChange");
        if(re==0) {
          // self.showAlert = false
          console.log('执行成功:1111557775');
          // sleep(1000)
          clearInterval(window.setIntervalId)
          window.setIntervalId = setInterval('window.writeInterval()',1000)
          // window.writeInterval()
          return true;
        } else {
          self.showAlert = true
          console.log('执行失敗:11');
          setTimeout("window.setNotify()",2000)
        }

      }
      window.writeCallback = function (re) {
        console.log(re)
      }
      window.writeInterval = function()
      {
        var wrTore = Register.getF03String(1, 50, 30)
        var deviceId = window.getStorageSync('deviceId');
        var serviceId = window.getStorageSync('serviceId');
        var characteristicId = window.getStorageSync('characteristicId');
        var data = window.writeTo16(wrTore);
        console.log('写入：1，50，3,Ios')
        window.hilink.writeBLECharacteristicValue(deviceId, serviceId, characteristicId, data,"writeCallback")
      }
      window.writeFunction = function (wrTore)
      {
        var deviceId = window.getStorageSync('deviceId')
        var serviceId = window.getStorageSync('serviceId')
        var characteristicId = window.getStorageSync('characteristicId')
        var data = window.writeTo16(wrTore)
        var err = window.hilink.writeBLECharacteristicValue(deviceId, serviceId, characteristicId, data,"writeCallback")
      }
      window.getSystemInfoSyncCallBack = function (re) {
        var info = eval("("+re+")")
        if(info.platform=='iOS'){
          self.OSTypeSet = true
          window.isIOSdevSETING = true
        } else {
          self.OSTypeSet = false
          window.isIOSdevSETING = false
        }
        if(self.OSTypeSet==true) {
          sleep(1000)
        }
        window.hilink.onBLEConnectionStateChange ("connetState")
        var re = window.hilink.getCurrentRegisteredDevice('getCurrentRegisteredDeviceM')
      }
      window.getCurrentRegisteredDeviceM = function(re){
        var data = eval("("+re+")")
        self.deviceIdData = data.deviceId

        if(self.OSTypeSet==true) {
          window.hilink.getBLEDeviceCharacteristics('','','setNotifyIOS')
          var errcode = window.hilink.startBluetoothDevicesDiscovery([],0,0)

          window.hilink.onBluetoothDeviceFound("onBluetoothDeviceFoundCallback")
          clearTimeout(window.setTimeoutDevices)
          window.setTimeoutDevices = setTimeout("window.PeconnectDeal()",2000)
        } else {
          window.hilink.createBLEConnection(self.deviceIdData)
        }
      }
      window.PeconnectDeal = function(){
        console.log("取到设备数值:"+self.TempARRDevice)
        if (self.TempARRDevice.length==0){
          clearTimeout(window.setTimeoutDevices)
          window.setTimeoutDevices = setTimeout("window.PeconnectDeal()",2000)
          return
        }
        self.iosUUIDCur = self.TempARRDevice.pop()
        console.log("取到设备数值第一个值:"+self.iosUUIDCur)
        window.hilink.createBLEConnection(self.iosUUIDCur)
      }
      window.onBluetoothDeviceFoundCallback = function(re) {
        var data = eval("("+re+")")
        console.log(data.localName)
        var aaa = true
        // if(data.localName==='Pooai-08'){
        //   aaa = false
        //   self.iosUUIDCur = data.deviceId
        //   console.log("pppppp"+self.iosUUIDCur)
        //   window.hilink.createBLEConnection(self.iosUUIDCur )
        // }
        if(data.localName==='Pooai-08'){
          self.TempARRDevice.push(data.deviceId)
        }
      }
      window.setNotifyIOS = function(){
        var deviceId = window.getStorageSync('deviceId');
        var serviceId = window.getStorageSync('serviceId');
        var characteristicId = window.getStorageSync('characteristicId');
        var re = window.hilink.notifyBLECharacteristicValueChange(deviceId,serviceId,characteristicId,true);

        if(re==0) {
          // self.showAlert = false
          console.log('执行成功:1111555');
          clearInterval(window.setIntervalId)
          // sleep(2000)
          window.setIntervalId = setInterval("window.writeInterval()",1000)
          // window.writeInterval()
          return true;
        } else {
          self.showAlert = true
          console.log('执行失敗:16661');
          // window.setNotifyIOS()
        }
      }
      window.writeTo16 = function (dataArr) {
        var newstr = '';
        for(var i = 0;i< dataArr.length;i++) {
          var str16 = (Array(2).join(0) + dataArr[i].toString(16)).slice(-2);
          newstr += str16
        }
        return newstr
      }
      window.readTo10 = function (dataStr) {
        var newArr = new Array
        for(var i = 0; i<dataStr.length;i=i+2) {
          newArr.push(parseInt(dataStr.substring(i,i+2),16))
        }
        return newArr
      }
      window.stringToBytes = function ( str ) {
        var ch, st, re = [];
        for (var i = 0; i < str.length; i++ ) {
          ch = str.charCodeAt(i);  // get char
          st = [];                 // set up "stack"
          do {
            st.push( ch & 0xFF );  // push byte to stack
            ch = ch >> 8;          // shift value down by 1 byte
          }
          while ( ch )
          re = re.concat( st.reverse() );
        }
        return re
      }

      window.getStorageSync = function (key) {

        if (self.OSTypeSet==false) {
          // var deId = "C8:FD:19:58:BC:10"
          var deId = self.deviceIdData
          var serviceId = "0000ffe0-0000-1000-8000-00805f9b34fb"
          var characteristicId = "0000ffe1-0000-1000-8000-00805f9b34fb"
        } else if(self.OSTypeSet==true){
          var deId = self.iosUUIDCur
          var serviceId = "ffe0"
          var characteristicId = "ffe1"
        }
        switch (key) {
          case 'deviceId':
            return deId
          // return deId
          case 'serviceId':
            return serviceId
          case 'characteristicId':
            return characteristicId
        }
      }

    },
    setMain (switchTo) {
      switch (switchTo) {
        case 'sdqxjcc':
          this.OPJCC()
          break
        case 'sdqxjccclose':
          this.OPJCLOSS()
          break
        case 'pengzzj':
          this.zijieIng=true
          window.wsetshowNUM = setTimeout('wSetShow()',8000)
          this.setRegisterBitValue({stateData:this.stateData,starRag:50,regBit:4,val:1})
          break;
        case 'fangG':
          // console.log('翻盖')
          // this.fangGLoad = true
          // this.showAlertLoad = true
          //
          // clearTimeout(window.OUTNUM)
          // window.OUTNUM = setTimeout('window.fangGLoadingFalse()',2000)

          var fangG = window.document.getElementById("fangG");
          if (fangG.checked == true) {
            this.setRegisterBitValue({stateData:this.stateData,starRag:57,regBit:14,val:1})
          } else {
            this.setRegisterBitValue({stateData:this.stateData,starRag:57,regBit:14,val:0})
          }
          break
        case 'Mute':
          var Mute = window.document.getElementById("Mute");
          // this.MuteLoad = true
          // this.showAlertLoad = true

          // clearTimeout(window.OUTNUM)
          // window.OUTNUM = setTimeout('window.MuteLoadingFalse()',2000)

          if (Mute.checked == true) {
            this.setRegisterBitValue({stateData:this.stateData,starRag:57,regBit:15,val:0})
          } else {
            this.setRegisterBitValue({stateData:this.stateData,starRag:57,regBit:15,val:1})
          }
          break
        case 'Ydeng':
          var Ydeng = window.document.getElementById("Ydeng");
          if (Ydeng.checked == true) {
            this.setRegisterBitValue({stateData:this.stateData,starRag:57,regBit:13,val:1})
          } else {
            this.setRegisterBitValue({stateData:this.stateData,starRag:57,regBit:13,val:0})
          }
          break
        case 'qingXi':
          var qingXi = window.document.getElementById("qingXi");
          // this.qingXiLoad = true
          // this.showAlertLoad = true
          //
          // clearTimeout(window.OUTNUM)
          // window.OUTNUM = setTimeout('window.qingXiLoadingFalse()',2000)

          if (qingXi.checked == true) {
            this.setRegisterBitValue({stateData:this.stateData,starRag:50,regBit:7,val:1})
          } else {
            this.setRegisterBitValue({stateData:this.stateData,starRag:50,regBit:7,val:0})
          }
          break
        case 'tunXi':
          var tunXi = window.document.getElementById("tunXi");
          if (tunXi.checked == true) {
            this.setRegisterBitValue({stateData:this.stateData,starRag:50,regBit:9,val:1})
          } else {
            this.setRegisterBitValue({stateData:this.stateData,starRag:50,regBit:9,val:0})
          }
          break
      }
      // window.writeInterval()
    },
    finishDeviceA(){
      window.hilink.finishDeviceActivity()
    },
    UpdateSystem() {
      clearInterval(window.setIntervalId)
      this.$router.push('/SetMainUpdate')
      return
      clearInterval(window.setIntervalId)
      if(this.CanClickTimes == false) {
        return
      }
      this.CanClickTimes = false
      this.AxiosTdev()
      this.SetIsUpdateTypeValueC({type: 1})
      //查看90寄存器是否为1
      var wrTore = Register.getF03String(1, 90, 1)
      var deviceId = window.getStorageSync('deviceId');
      var serviceId = window.getStorageSync('serviceId');
      var characteristicId = window.getStorageSync('characteristicId');
      var data = window.writeTo16(wrTore);
      console.log('写入：1，90，1')
      window.hilink.writeBLECharacteristicValue(deviceId, serviceId, characteristicId, data, "writeCallback")
    },

    initData(){
      // this.havInited = true
      this.IsclearCC = true
      this.Mute = !Register.getRegisterBitValue(this.stateData[57-this.startAddr].data,57,15)

      this.fangG = Register.getRegisterBitValue(this.stateData[57-this.startAddr].data,57,14)

      this.qingXi = Register.getRegisterBitValue(this.stateData[50-this.startAddr].data,50,7)

      this.tunXi = Register.getRegisterBitValue(this.stateData[50-this.startAddr].data,50,9)

      this.Ydeng = Register.getRegisterBitValue(this.stateData[57-this.startAddr].data,57,13)

      if (this.havInited==false) {

        // clearTimeout(window.SetTimeOUTNumB)
        // window.SetTimeOUTNumB = setTimeout('window.setAllLoading()',1000)
        this.showAlert = false
        this.showAlertLoad = false
        // this.fangGLoad = false
        // this.qingXiLoad = false
        // this.MuteLoad = false

        this.havInited = true
        this.IsgenXINData = this.stateData[78-this.startAddr].data
        var zhuBANBEN = (this.IsgenXINData & 0x00f0) >> 4
        var fuBANBEN = (this.IsgenXINData & 0x000f)/10
        this.BANBEN = zhuBANBEN + fuBANBEN

        if(window.isIOSdevSETING==true){
          window.getRCTypeResultCallbackF = response => {
            var resData = eval("("+response+")")
            console.log(resData)
            if(resData.errCode==0){
              var responseData = resData.data[1]
              if (this.BANBEN<responseData) {
                this.SetisUpdateInYUN({isUpdateInYUN:true})
              } else {
                this.SetisUpdateInYUN({isUpdateInYUN:false})
              }
            } else {
              alert('數據下載失敗')
            }
          }
          var reqParams = {
            domain:'http://www.pooai.cn',
            method:'GET',
            path:'/wx/hwapp/web/index.php?r=site/banben'
          }
          window.hilink.requestThirdPartConfig(JSON.stringify(reqParams),'getRCTypeResultCallbackF')
        } else {
          Vue.axios.get('http://www.pooai.cn/wx/hwapp/web/index.php?r=site/banben').then((response) => {
            var responseData = response.data[1]
            if (this.BANBEN<responseData) {
              this.SetisUpdateInYUN({isUpdateInYUN:true})
            } else {
              this.SetisUpdateInYUN({isUpdateInYUN:false})
            }
          })
        }
       //
      }
    }

  }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .jiancegengxin {
    position:relative;
    padding:2px;
  }
  .tip {
    display:block;
    background:#f00;
    border-radius:50%;
    width:8px;
    height:8px;
    top:0px;
    right:0px;
    position:absolute;
  }
  .aui-switch{
    width: 2.6rem !important;
    height: 1.6rem !important;
    border-radius: 0.8rem!important;
  }
  .aui-switch:before {
    width: 1.4rem !important;
    height: 1.4rem!important;
    border-radius: 0.7rem!important;
  }
  .headerDiv{
    height: 2rem;
    width: 100%;
    /*background-color: #288af0;*/
  }
  .aui-list-item-title{
    font-size: 1.33rem !important;
  }
  body{
    background: #ffffff !important;
    font-size: 16px !important;
  }
  .aui-bar-nav {
    background: #ffffff !important;
    border-bottom: 3px solid #e2e2e2
  }
  .aui-bar-nav a {
    color: #000 !important;

    font-weight: 500;
  }
  .aui-content{
    margin:0 0.8rem;
  }
  .aui-content>ul>li{
    /*border-bottom: 1px solid #ccc;*/
    padding:0.5rem 0.5rem;
  }
  .detection{
    margin:0 1rem;
    height: 4rem !important;
    line-height: 2.25rem;
    /*border-bottom:1px solid #ccc;*/
  }
  .aui-list .aui-list-item-inner{
    padding:0.75rem 0.5rem 0.75rem 0;
  }
  .aui-pull-left img{
    /*margin: 1.3rem;*/
  }
  .aui-bar{
    padding-top: 3rem !important;
    padding-bottom: 0rem !important;
    margin-left: -10px !important;
  }
</style>
